# 该案例主要解决多线程问题，爬取数据时异步前进
import requests
headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)'
                      ' Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.76'
    }
urls = [
        '','','']
#封装一个函数，获取网页内容
def get_content(url):
    print('正在爬取',url)
    response = requests.get(url=url,headers=headers)
    if response.status_code == 200:
        return response.content
#进行数据解析
def parse_content(content):
    print(len(content))

for url in urls:
    content = get_content() #此处发生阻塞
    parse_content(content)